﻿@inherits BlazorStrap.Shared.Components.Common.BSBreadcrumbBase
@namespace BlazorStrap.V4

@if (string.IsNullOrEmpty(BasePath))
{
    <nav style="--bs-breadcrumb-divider: @Divider;" aria-label="breadcrumb">
        <ol class="@ClassBuilder" @attributes="Attributes">
            @ChildContent
        </ol>
    </nav>
}
else
{
    <nav style="--bs-breadcrumb-divider: @Divider;" aria-label="breadcrumb">
        <ol class="@ClassBuilder" @attributes="Attributes">
            @if (Tree.Count > MaxItems)
            {
                if (NavigationManager?.Uri == Tree.First().Key)
                {
                    <li class="breadcrumb-item active">
                        @Tree.First().Value
                    </li>
                }
                else
                {
                    <li class="breadcrumb-item">
                        <a href="@Tree.First().Key">...</a>
                    </li>
                }
            }
            @foreach (var item in Tree.Skip(Skip))
            {
                if (NavigationManager?.Uri == item.Key)
                {
                    <li class="breadcrumb-item active">
                        @item.Value
                    </li>
                }
                else
                {
                    <li class="breadcrumb-item">
                        <a href="@item.Key">@item.Value</a>
                    </li>
                }
            }
        </ol>
    </nav>
}